﻿@using CREAPA.UL.Web.Models;
@using CREAPA.UL.Web.HtmlHelpers
@model CREAPA.Dominio.OS

@{
    ViewBag.Title = "Detalhes";
}



<h2>Detalhes da OS</h2>

@{    
    var grid = new WebGrid(ViewBag.ListaOS); 
}

@{    
    var gridAnexo = new WebGrid(ViewBag.ListaDeAnexoOs); 
}

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Detalhes</legend><p>

         @Html.HiddenFor(model => model.Id)

         <div class="display-label">
       <b>  @Html.DisplayNameFor(model => model.Id):</b>
        @Html.DisplayFor(model => model.Id)
        </div> </p>

        <p><div class="editor-label">
        <b> @Html.DisplayNameFor(model => model.DataCadOs):</b>
        @Html.DisplayFor(model => model.DataCadOs)
    </div>
        </p>
<p>
         <p> <div class="editor-label">
        <b> @Html.DisplayNameFor(model => model.PessoaCadastrou):</b>
            @Html.DisableableDropDownList("PessoaCadastrou",null,null, new { id = "cbGender1", style = "width:150px;"})
    </div>
<p>    
        </p>
        <p><div class="editor-label">
        <b> @Html.DisplayNameFor(model => model.PessoaInteressado):</b>
        @Html.DisableableDropDownList("PessoaInteressado",null,null, new { id = "cbGender2", style = "width:150px;"})
    </div>
        </p>
<p>
    <p> <div class="editor-label">
        <b> @Html.DisplayNameFor(model => model.Problema):</b>
        @Html.DisableableDropDownList("Problema",null,null, new { id = "cbGender3", style = "width:500px;"})
    </div>
    </p>
<p>
        <div class="display-label">
           <b> @Html.LabelFor(model => model.Descricao):</b>
              @Html.DisplayFor(model => model.Descricao)
        </div></p>
<p>  
    
         <b>   @Html.LabelFor(model => model.Setor):</b>
        
        <div class="editor-field">
        <div class="login-msg">
            @Html.DisableableDropDownList("Setor",null,null, new { id = "cbGender4", style = "width:300px;"})
            </div>
        </div></p>
 <p>       
        <div class="editor-label">
          <b>  @Html.LabelFor(model => model.OrigemOS)</b>
        </div>
        <div class="editor-field">
            @Html.DisableableDropDownList("OrigemOS",null,null, new { id = "cbGender5", style = "width:100px;"})            
        </div></p>

        <div class="display-label">
         <b>   @Html.LabelFor(model => model.TempoExec):</b>
              @Html.DisplayFor(model => model.TempoExec)
              @Html.DisplayFor(model => model.TempoUnidade)

        </div></p>

        @{
    if (ViewBag.ListaDeAnexoOs.Count > 0)
    {
         <p>
        <div class="editor-label">
           Anexos da OS
        </div>
        <div>
            @gridAnexo.GetHtml( tableStyle: "tableAO",
        alternatingRowStyle: "alternateAO",
        headerStyle: "headerAO",
        footerStyle: "footerAO",
        mode: WebGridPagerModes.FirstLast | WebGridPagerModes.NextPrevious,
        firstText: "Primeiro",
        previousText: "Anterior",
        nextText: "Próximo",
        lastText: "Último",columns: gridAnexo.Columns(
              gridAnexo.Column("Nome", header:"Nome", format: @<text><center>@item.Nome</center></text>),              
              gridAnexo.Column("Data", header:"Data de Cadastro", format: @<text>@item.Data</text>),
              gridAnexo.Column("PessoaCadastrou", header:"Cadastrado por", format: @<text><center>@item.PessoaCadastrou<center></text>),
              gridAnexo.Column("Download",   header: "Download",   format: @<text><center>@Html.ActionLink("Download", "Download", new { caminho = item.Caminho })</center></text>)))
        </div>
            </p>
    }
}

        <p>
        <div class="editor-label">
         <b>  Histórico da OS:</b>
        </div>
        <div>
            @grid.GetHtml( tableStyle: "tableAO",
        alternatingRowStyle: "alternateAO",
        headerStyle: "headerAO",
        footerStyle: "footerAO",
        mode: WebGridPagerModes.FirstLast | WebGridPagerModes.NextPrevious,
        firstText: "Primeiro",
        previousText: "Anterior",
        nextText: "Próximo",
        lastText: "Último",columns: grid.Columns(
              grid.Column("DescTipoSituacao", header:"Situacao", format: @<text><center>@item.DescTipoSituacao</center></text>),
              grid.Column("Descricao", header:"Descrição", format: @<text><div style='width: 30em'>@item.Descricao</div></text>),
              grid.Column("Data", header:"Data de Cadastro", format: @<text>@item.Data</text>),
              grid.Column("PessoaCadastrou", header:"Cadastrado por", format: @<text><center>@item.PessoaCadastrou<center></text>)))
        </div>
            </p>
    
        <div>
</div>

        <p>
            @Html.ActionLink("voltar", "ListarTodas",null,new { @class = "button" })
        </p>

        
    

    </fieldset>
<script type="text/javascript">
    $("#cb_Toggle").ready(function () {
        var $Gender = $("#cbGender1");

        $Gender.disableDropDownList();
    });
</script>   
    
<script type="text/javascript">
    $("#cb_Toggle").ready(function () {
        var $Gender = $("#cbGender2");

        $Gender.disableDropDownList();
    });
</script>  
    
    <script type="text/javascript">
        $("#cb_Toggle").ready(function () {
            var $Gender = $("#cbGender3");

            $Gender.disableDropDownList();
        });
</script> 
    
    <script type="text/javascript">
        $("#cb_Toggle").ready(function () {
            var $Gender = $("#cbGender4");

            $Gender.disableDropDownList();
        });
</script> 
    
    <script type="text/javascript">
        $("#cb_Toggle").ready(function () {
            var $Gender = $("#cbGender5");

            $Gender.disableDropDownList();
        });
</script> 
    
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
